/*
 Navicat Premium Data Transfer

 Source Server         : localMysql
 Source Server Type    : MySQL
 Source Server Version : 50717
 Source Host           : localhost
 Source Database       : memorypalace

 Target Server Type    : MySQL
 Target Server Version : 50717
 File Encoding         : utf-8

 Date: 05/19/2017 08:36:28 AM
*/

SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
--  Table structure for `t_card`
-- ----------------------------
DROP TABLE IF EXISTS `t_card`;
CREATE TABLE `t_card` (
  `cardId` varchar(255) NOT NULL,
  `cardStyleId` varchar(255) NOT NULL,
  `noteId` varchar(255) DEFAULT NULL,
  `cardNextStudyTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `cardHardFactory` int(10) NOT NULL,
  `cardStudyCount` int(10) NOT NULL,
  `cardWrongCount` int(10) NOT NULL,
  PRIMARY KEY (`cardId`),
  KEY `cardStyleId` (`cardStyleId`),
  KEY `noteId` (`noteId`),
  CONSTRAINT `fk_t_cardStyle` FOREIGN KEY (`cardStyleId`) REFERENCES `t_cardStyle` (`cardStyleId`),
  CONSTRAINT `fk_t_card_noteId` FOREIGN KEY (`noteId`) REFERENCES `t_note` (`noteId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `t_card`
-- ----------------------------
BEGIN;
INSERT INTO `t_card` VALUES ('7b455fb0-3863-11e7-8e4c-e18a12b866d4', '6b97f9ac-3858-11e7-8e4c-e18a12b866d4', 'b80f931c-3858-11e7-8e4c-e18a12b866d4', '2017-05-17 18:58:27', '100', '20', '20'), ('8d471614-3858-11e7-8e4c-e18a12b866d4', '6b97f9ac-3858-11e7-8e4c-e18a12b866d4', '179772ec-3858-11e7-8e4c-e18a12b866d4', '2017-05-17 18:58:38', '100', '20', '20');
COMMIT;

-- ----------------------------
--  Table structure for `t_cardStudyRecord`
-- ----------------------------
DROP TABLE IF EXISTS `t_cardStudyRecord`;
CREATE TABLE `t_cardStudyRecord` (
  `cardStudyRecordId` varchar(255) NOT NULL,
  `cardId` varchar(255) NOT NULL,
  `studyTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `studyInterval` int(10) NOT NULL,
  `answerButton` int(10) NOT NULL,
  `costSeconds` int(10) NOT NULL,
  PRIMARY KEY (`cardStudyRecordId`),
  KEY `fk_t_card` (`cardId`),
  CONSTRAINT `fk_t_card` FOREIGN KEY (`cardId`) REFERENCES `t_card` (`cardId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Table structure for `t_cardStyle`
-- ----------------------------
DROP TABLE IF EXISTS `t_cardStyle`;
CREATE TABLE `t_cardStyle` (
  `cardStyleId` varchar(255) NOT NULL,
  `noteTypeId` varchar(255) NOT NULL,
  `cardStyleName` varchar(255) NOT NULL,
  `frontHTML` text NOT NULL,
  `backHTML` text NOT NULL,
  `css` text NOT NULL,
  PRIMARY KEY (`cardStyleId`),
  KEY `noteTypeId` (`noteTypeId`),
  CONSTRAINT `fk_cardStyle_noteTypeId` FOREIGN KEY (`noteTypeId`) REFERENCES `t_noteType` (`noteTypeId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `t_cardStyle`
-- ----------------------------
BEGIN;
INSERT INTO `t_cardStyle` VALUES ('6b97f9ac-3858-11e7-8e4c-e18a12b866d4', '355980cc-3858-11e7-8e4c-e18a12b866d4', '正对反', '{{正面}}', '{{反面}}', '.card {\n font-family: arial;\n font-size: 20px;\n text-align: center;\n color: black;\n background-color: white;\n}\n');
COMMIT;

-- ----------------------------
--  Table structure for `t_comment`
-- ----------------------------
DROP TABLE IF EXISTS `t_comment`;
CREATE TABLE `t_comment` (
  `commentId` varchar(255) NOT NULL,
  `goodsId` varchar(255) NOT NULL,
  `userId` varchar(255) NOT NULL,
  `stars` int(11) NOT NULL,
  `time` datetime NOT NULL,
  `title` varchar(255) NOT NULL,
  `text` text NOT NULL,
  PRIMARY KEY (`commentId`),
  KEY `fk_t_goods1` (`goodsId`),
  KEY `fk_t_user4` (`userId`),
  CONSTRAINT `fk_t_goods1` FOREIGN KEY (`goodsId`) REFERENCES `t_goods` (`goodsId`),
  CONSTRAINT `fk_t_user4` FOREIGN KEY (`userId`) REFERENCES `t_user` (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Table structure for `t_deck`
-- ----------------------------
DROP TABLE IF EXISTS `t_deck`;
CREATE TABLE `t_deck` (
  `deckId` varchar(255) NOT NULL,
  `userId` varchar(255) DEFAULT NULL,
  `goodsId` varchar(255) DEFAULT NULL,
  `deckName` varchar(255) NOT NULL,
  PRIMARY KEY (`deckId`),
  KEY `fk_t_user` (`userId`),
  KEY `goodsId` (`goodsId`),
  CONSTRAINT `fk_t_deck_goodsId` FOREIGN KEY (`goodsId`) REFERENCES `t_goods` (`goodsId`),
  CONSTRAINT `fk_t_user` FOREIGN KEY (`userId`) REFERENCES `t_user` (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `t_deck`
-- ----------------------------
BEGIN;
INSERT INTO `t_deck` VALUES ('f47ce239-c285-4e48-bc96-62bdbc40f863', 'c34487b4-35e3-11e7-8e4c-e18a12b866d4', null, 'html5'), ('fdc7ac26-874f-499c-9d65-0f864e6a51ea', 'c34487b4-35e3-11e7-8e4c-e18a12b866d4', null, 'java'), ('fe6e5024-3857-11e7-8e4c-e18a12b866d4', 'c34487b4-35e3-11e7-8e4c-e18a12b866d4', null, '翻译');
COMMIT;

-- ----------------------------
--  Table structure for `t_goods`
-- ----------------------------
DROP TABLE IF EXISTS `t_goods`;
CREATE TABLE `t_goods` (
  `goodsId` varchar(255) NOT NULL,
  `goodsNo` varchar(255) NOT NULL,
  `submitPerson` varchar(255) NOT NULL,
  `goodsType` int(11) NOT NULL,
  `star` decimal(10,0) DEFAULT NULL,
  `likes` int(11) DEFAULT NULL,
  `comments` int(11) DEFAULT NULL,
  `submitTime` time NOT NULL,
  `version` decimal(10,0) NOT NULL,
  `introduction` text NOT NULL,
  `cost` int(11) NOT NULL,
  PRIMARY KEY (`goodsId`),
  KEY `fk_t_user1` (`submitPerson`),
  CONSTRAINT `fk_t_user1` FOREIGN KEY (`submitPerson`) REFERENCES `t_user` (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Table structure for `t_goodsBuyRecord`
-- ----------------------------
DROP TABLE IF EXISTS `t_goodsBuyRecord`;
CREATE TABLE `t_goodsBuyRecord` (
  `recordId` varchar(255) NOT NULL,
  `goodsId` varchar(255) NOT NULL,
  `buyPerson` varchar(255) NOT NULL,
  `buyTime` datetime NOT NULL,
  PRIMARY KEY (`goodsId`),
  KEY `fk_t_user2` (`buyPerson`),
  CONSTRAINT `fk_t_user2` FOREIGN KEY (`buyPerson`) REFERENCES `t_user` (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Table structure for `t_knowledgeTree`
-- ----------------------------
DROP TABLE IF EXISTS `t_knowledgeTree`;
CREATE TABLE `t_knowledgeTree` (
  `knowledgeId` varchar(255) NOT NULL,
  `userId` varchar(255) NOT NULL,
  `fatherKnowledgeId` varchar(255) DEFAULT NULL,
  `knowledgeName` varchar(255) DEFAULT NULL,
  `knowledgeType` varchar(255) NOT NULL,
  PRIMARY KEY (`knowledgeId`),
  KEY `fk_t_user_know` (`userId`),
  KEY `fk_t_knowledge` (`fatherKnowledgeId`),
  CONSTRAINT `fk_t_knowledge` FOREIGN KEY (`fatherKnowledgeId`) REFERENCES `t_knowledgeTree` (`knowledgeId`),
  CONSTRAINT `fk_t_user_know` FOREIGN KEY (`userId`) REFERENCES `t_user` (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `t_knowledgeTree`
-- ----------------------------
BEGIN;
INSERT INTO `t_knowledgeTree` VALUES ('166c469e-3859-11e7-8e4c-e18a12b866d4', 'c34487b4-35e3-11e7-8e4c-e18a12b866d4', 'e5c27018-3858-11e7-8e4c-e18a12b866d4', '翻译', '1'), ('49c82e4c-3bdb-11e7-a001-1b41f5094e6c', 'c34487b4-35e3-11e7-8e4c-e18a12b866d4', 'e5c27018-3858-11e7-8e4c-e18a12b866d4', '111', '1'), ('a54838b0-3943-11e7-a001-1b41f5094e6c', 'c34487b4-35e3-11e7-8e4c-e18a12b866d4', 'e5c27018-3858-11e7-8e4c-e18a12b866d4', '口译', '1'), ('e5c27018-3858-11e7-8e4c-e18a12b866d4', 'c34487b4-35e3-11e7-8e4c-e18a12b866d4', null, '英语', '1');
COMMIT;

-- ----------------------------
--  Table structure for `t_like`
-- ----------------------------
DROP TABLE IF EXISTS `t_like`;
CREATE TABLE `t_like` (
  `likeId` varchar(255) NOT NULL,
  `goodsId` varchar(255) NOT NULL,
  `userId` varchar(255) NOT NULL,
  PRIMARY KEY (`likeId`),
  KEY `like_t_goods` (`goodsId`),
  KEY `like_t_user` (`userId`),
  CONSTRAINT `like_t_goods` FOREIGN KEY (`goodsId`) REFERENCES `t_goods` (`goodsId`),
  CONSTRAINT `like_t_user` FOREIGN KEY (`userId`) REFERENCES `t_user` (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Table structure for `t_newCardStudyScheme`
-- ----------------------------
DROP TABLE IF EXISTS `t_newCardStudyScheme`;
CREATE TABLE `t_newCardStudyScheme` (
  `newCardStudySchemeId` varchar(255) NOT NULL,
  `studySchemeId` varchar(255) NOT NULL,
  `step` int(11) NOT NULL,
  `newCardCount` int(11) NOT NULL,
  `graduateInterval` int(11) NOT NULL,
  `easyInterval` int(11) NOT NULL,
  `easyFactor` int(11) NOT NULL,
  PRIMARY KEY (`newCardStudySchemeId`),
  KEY `fk_t_studyScheme1` (`studySchemeId`),
  CONSTRAINT `fk_t_studyScheme1` FOREIGN KEY (`studySchemeId`) REFERENCES `t_studyScheme` (`studySchemeId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Table structure for `t_note`
-- ----------------------------
DROP TABLE IF EXISTS `t_note`;
CREATE TABLE `t_note` (
  `noteId` varchar(255) NOT NULL,
  `deckId` varchar(255) DEFAULT NULL,
  `areaContents` text NOT NULL,
  `noteTypeId` varchar(255) DEFAULT NULL,
  `areaNames` varchar(255) NOT NULL,
  `noteCreateTime` datetime DEFAULT NULL,
  `noteEditTime` datetime DEFAULT NULL,
  PRIMARY KEY (`noteId`),
  KEY `noteTypeId` (`noteTypeId`),
  KEY `deckId` (`deckId`),
  CONSTRAINT `fk_note_deckId` FOREIGN KEY (`deckId`) REFERENCES `t_deck` (`deckId`),
  CONSTRAINT `fk_note_noteTypeId` FOREIGN KEY (`noteTypeId`) REFERENCES `t_noteType` (`noteTypeId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `t_note`
-- ----------------------------
BEGIN;
INSERT INTO `t_note` VALUES ('179772ec-3858-11e7-8e4c-e18a12b866d4', 'fe6e5024-3857-11e7-8e4c-e18a12b866d4', '{\"正面\":\"他正在专心看书\",\"反面\":\"He is absorbed in his book.\"}', '355980cc-3858-11e7-8e4c-e18a12b866d4', '[\"正面\",\"反面\"]', '2017-05-14 11:49:30', '2017-05-14 11:49:34'), ('b80f931c-3858-11e7-8e4c-e18a12b866d4', 'fe6e5024-3857-11e7-8e4c-e18a12b866d4', '{\"正面\":\"眼睛是心灵的窗口。\",\"反面\":\"Eyes are windows to the soul.\"}', '355980cc-3858-11e7-8e4c-e18a12b866d4', '[\"正面\",\"反面\"]', '2017-05-14 11:52:44', '2017-05-14 11:52:47');
COMMIT;

-- ----------------------------
--  Table structure for `t_noteConnect`
-- ----------------------------
DROP TABLE IF EXISTS `t_noteConnect`;
CREATE TABLE `t_noteConnect` (
  `noteConnectId` varchar(255) NOT NULL,
  `noteId` varchar(255) NOT NULL,
  `fatherKnowledgeId` varchar(255) NOT NULL,
  `sequenceIndex` int(11) DEFAULT NULL,
  `pointTo` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`noteConnectId`),
  KEY `noteId` (`noteId`),
  KEY `fatherIdKonwledgeId` (`fatherKnowledgeId`),
  KEY `pointTo` (`pointTo`),
  CONSTRAINT `fk_noteConnect_knowledgeId` FOREIGN KEY (`fatherKnowledgeId`) REFERENCES `t_knowledgeTree` (`knowledgeId`),
  CONSTRAINT `fk_noteConnect_noteId` FOREIGN KEY (`noteId`) REFERENCES `t_note` (`noteId`),
  CONSTRAINT `fk_noteConnect_pointTo` FOREIGN KEY (`pointTo`) REFERENCES `t_note` (`noteId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `t_noteConnect`
-- ----------------------------
BEGIN;
INSERT INTO `t_noteConnect` VALUES ('49ca9cf4-3bdb-11e7-a001-1b41f5094e6c', '179772ec-3858-11e7-8e4c-e18a12b866d4', '49c82e4c-3bdb-11e7-a001-1b41f5094e6c', null, null), ('49cc0710-3bdb-11e7-a001-1b41f5094e6c', 'b80f931c-3858-11e7-8e4c-e18a12b866d4', '49c82e4c-3bdb-11e7-a001-1b41f5094e6c', null, null), ('dbf7385e-3afe-11e7-a001-1b41f5094e6c', '179772ec-3858-11e7-8e4c-e18a12b866d4', 'a54838b0-3943-11e7-a001-1b41f5094e6c', null, null), ('dbf881aa-3afe-11e7-a001-1b41f5094e6c', 'b80f931c-3858-11e7-8e4c-e18a12b866d4', 'a54838b0-3943-11e7-a001-1b41f5094e6c', null, null), ('fd0af648-3acc-11e7-a001-1b41f5094e6c', '179772ec-3858-11e7-8e4c-e18a12b866d4', '166c469e-3859-11e7-8e4c-e18a12b866d4', null, null), ('fd0bd202-3acc-11e7-a001-1b41f5094e6c', 'b80f931c-3858-11e7-8e4c-e18a12b866d4', '166c469e-3859-11e7-8e4c-e18a12b866d4', null, null);
COMMIT;

-- ----------------------------
--  Table structure for `t_noteType`
-- ----------------------------
DROP TABLE IF EXISTS `t_noteType`;
CREATE TABLE `t_noteType` (
  `noteTypeId` varchar(255) NOT NULL,
  `userId` varchar(255) DEFAULT NULL,
  `goodsId` varchar(255) DEFAULT NULL,
  `areaNames` varchar(255) NOT NULL,
  `noteTypeName` varchar(255) NOT NULL,
  PRIMARY KEY (`noteTypeId`),
  KEY `userId` (`userId`),
  CONSTRAINT `fk_noteType_userId` FOREIGN KEY (`userId`) REFERENCES `t_user` (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `t_noteType`
-- ----------------------------
BEGIN;
INSERT INTO `t_noteType` VALUES ('355980cc-3858-11e7-8e4c-e18a12b866d4', 'c34487b4-35e3-11e7-8e4c-e18a12b866d4', null, '[\"正面\",\"反面\"]', '基础正反');
COMMIT;

-- ----------------------------
--  Table structure for `t_reviewCardStudyScheme`
-- ----------------------------
DROP TABLE IF EXISTS `t_reviewCardStudyScheme`;
CREATE TABLE `t_reviewCardStudyScheme` (
  `reviewCardStudySchemeId` varchar(255) NOT NULL,
  `studySchemeId` varchar(255) NOT NULL,
  `maxReviewCount` int(11) NOT NULL,
  `easyBonus` int(11) NOT NULL,
  `intervalModifier` int(11) NOT NULL,
  `maximumInterval` int(11) NOT NULL,
  PRIMARY KEY (`reviewCardStudySchemeId`),
  KEY `reviewCardStudyScheme_t_studyScheme` (`studySchemeId`),
  CONSTRAINT `reviewCardStudyScheme_t_studyScheme` FOREIGN KEY (`studySchemeId`) REFERENCES `t_studyScheme` (`studySchemeId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Table structure for `t_sort`
-- ----------------------------
DROP TABLE IF EXISTS `t_sort`;
CREATE TABLE `t_sort` (
  `sortId` varchar(255) NOT NULL,
  `sortKey` varchar(255) NOT NULL,
  PRIMARY KEY (`sortId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Table structure for `t_studyList`
-- ----------------------------
DROP TABLE IF EXISTS `t_studyList`;
CREATE TABLE `t_studyList` (
  `studyListId` varchar(255) NOT NULL,
  `userId` varchar(255) NOT NULL,
  `studySchemeId` varchar(255) NOT NULL,
  `studyListName` varchar(255) NOT NULL,
  `sortCondition` varchar(255) DEFAULT NULL,
  `screenCondition` varchar(255) NOT NULL,
  PRIMARY KEY (`studyListId`),
  KEY `fk_t_user_study` (`userId`),
  KEY `fk_t_studyScheme` (`studySchemeId`),
  CONSTRAINT `fk_t_studyScheme` FOREIGN KEY (`studySchemeId`) REFERENCES `t_studyscheme` (`studySchemeId`),
  CONSTRAINT `fk_t_user_study` FOREIGN KEY (`userId`) REFERENCES `t_user` (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `t_studyList`
-- ----------------------------
BEGIN;
INSERT INTO `t_studyList` VALUES ('50a64d26-3af4-11e7-a001-1b41f5094e6c', 'c34487b4-35e3-11e7-8e4c-e18a12b866d4', '60b925c6-3af4-11e7-a001-1b41f5094e6c', 'hah', 'null', '{\"deckName\":{\"value\":\"paizu\",\"pattern\":\"is\"}}');
COMMIT;

-- ----------------------------
--  Table structure for `t_studyScheme`
-- ----------------------------
DROP TABLE IF EXISTS `t_studyScheme`;
CREATE TABLE `t_studyScheme` (
  `studySchemeId` varchar(255) NOT NULL,
  `userId` varchar(255) NOT NULL,
  `studySchemeName` varchar(255) NOT NULL,
  `ignoreTimeMoreThan` int(11) NOT NULL,
  `studySequence` int(11) NOT NULL,
  PRIMARY KEY (`studySchemeId`),
  KEY `studyScheme_t_user` (`userId`),
  CONSTRAINT `studyScheme_t_user` FOREIGN KEY (`userId`) REFERENCES `t_user` (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `t_studyScheme`
-- ----------------------------
BEGIN;
INSERT INTO `t_studyScheme` VALUES ('60b925c6-3af4-11e7-a001-1b41f5094e6c', 'c34487b4-35e3-11e7-8e4c-e18a12b866d4', 'vf', '1', '1');
COMMIT;

-- ----------------------------
--  Table structure for `t_user`
-- ----------------------------
DROP TABLE IF EXISTS `t_user`;
CREATE TABLE `t_user` (
  `userId` varchar(255) NOT NULL,
  `userName` varchar(255) NOT NULL,
  `userEmail` varchar(255) NOT NULL,
  `userPwd` varchar(255) NOT NULL,
  `userPoints` varchar(255) NOT NULL,
  `userPower` int(11) NOT NULL,
  PRIMARY KEY (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `t_user`
-- ----------------------------
BEGIN;
INSERT INTO `t_user` VALUES ('c34487b4-35e3-11e7-8e4c-e18a12b866d4', 'wing', '1', '123', '100', '0');
COMMIT;

-- ----------------------------
--  Table structure for `t_userBackups`
-- ----------------------------
DROP TABLE IF EXISTS `t_userBackups`;
CREATE TABLE `t_userBackups` (
  `backUpTd` varchar(255) NOT NULL,
  `userId` varchar(255) NOT NULL,
  `time` datetime NOT NULL,
  `statement` varchar(255) NOT NULL,
  `fileName` varchar(255) NOT NULL,
  PRIMARY KEY (`backUpTd`),
  KEY `fk_t_user3` (`userId`),
  CONSTRAINT `fk_t_user3` FOREIGN KEY (`userId`) REFERENCES `t_user` (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Table structure for `t_wrongCardStudyScheme`
-- ----------------------------
DROP TABLE IF EXISTS `t_wrongCardStudyScheme`;
CREATE TABLE `t_wrongCardStudyScheme` (
  `wrongCardStudySchemeId` varchar(255) NOT NULL,
  `studySchemeId` varchar(255) NOT NULL,
  `step` int(11) NOT NULL,
  `newInterval` int(11) NOT NULL,
  `minInterval` int(11) NOT NULL,
  `maxWrongTimes` int(11) NOT NULL,
  `whenCardIsHard` int(11) NOT NULL,
  PRIMARY KEY (`wrongCardStudySchemeId`),
  KEY `wrongCardStudyScheme_t_studyScheme` (`studySchemeId`),
  CONSTRAINT `wrongCardStudyScheme_t_studyScheme` FOREIGN KEY (`studySchemeId`) REFERENCES `t_studyScheme` (`studySchemeId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

SET FOREIGN_KEY_CHECKS = 1;
